package demo;

import java.io.*;

public class PwDemo {
    public static void main(String[] args) throws FileNotFoundException {
        PrintWriter pw = new PrintWriter("pw.txt");
        pw.println("你好");
        pw.println("再见");
        System.out.println("写入完毕");
        pw.close();

        FileOutputStream fos = new FileOutputStream("pw2.txt");
        OutputStreamWriter osw = new OutputStreamWriter(fos);
        BufferedWriter bw = new BufferedWriter(osw);
        PrintWriter pw2 = new PrintWriter(bw);
        pw2.println("hello");
        pw2.println("goodbye");
        System.out.println("写入完毕");
        pw2.close();


    }
}
